<?php

namespace app\common\service;
use app\common\model\AdminUser;
class Lists
{

    public function ListData($rows)
    {
        $AdminUser = new AdminUser();
        foreach ($rows as $k => $v) {
            $item = $v;
            foreach ($item as $k2 => $v2) {
                if ($k2 == 'create_id' || $k2 == 'update_id') {
                    $user = $AdminUser->where("id='" . $v2 . "'")->field("name")->findOrEmpty()->toArray();
                    switch ($k2) {
                        case "create_id":
                            $rows[$k]['create_name'] = !empty($user['name']) ? $user['name'] : '';
                            break;
                        case "update_id":
                            $rows[$k]['update_name'] = !empty($user['name']) ? $user['name'] : '';
                            break;
                    }
                }
                if ($k2 == 'flow__status') {
                    $rows[$k]['flow__status'] = !empty($v['flow__status']) ? $v['flow__status'] : 1;
                }
            }
        }
        return $rows;
    }


}